//
//  MainViewController.m
//  QuickCare
//
//  Created by lidabiao on 16/7/10.
//  Copyright © 2016年 lidabiao. All rights reserved.
//

#import "MainViewController.h"
#import "NavigationController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
 
    [self addChildViewControllerWithStoryboard:@"Home" title:@"就诊" imageName:@"tab_normal_1" selectedImageName:@"tab_selected_1"];
    
    [self addChildViewControllerWithStoryboard:@"Discover" title:@"发现" imageName:@"tab_normal_2" selectedImageName:@"tab_selected_2"];
    
    [self addChildViewControllerWithStoryboard:@"Exercise" title:@"健身" imageName:@"tab_normal_3" selectedImageName:@"tab_selected_3"];
    
}

///  添加子控制器
///
///  @param Storyboard        Storyboard名
///  @param title             标签标题
///  @param imageName         默认图片名
///  @param selectedImageName 选中图片名
-(void)addChildViewControllerWithStoryboard:(NSString *)Storyboard title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName
{
    UIStoryboard *st = [UIStoryboard storyboardWithName:Storyboard bundle:nil];
    
    NavigationController *vc = [st instantiateInitialViewController];
    
    vc.title = title;
    
    [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithRed:28/255.0 green:193/255.0 blue:155/255.0 alpha:1.0]} forState:UIControlStateSelected];
    
    vc.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    vc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    [self addChildViewController:vc];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
